package com.ruyuan.user.api.model.enums;

import java.util.Arrays;

/**
 * @author xx
 */
public enum GenderEnum {

    MALE("M", "男性"),
    FEMALE("F", "女性");

    private String code;

    private String description;

    GenderEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public static GenderEnum getByCode(String code) {
        return Arrays.stream(GenderEnum.values()).filter(gender -> gender.getCode().equals(code)).findFirst().orElse(null);
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
}
